package fule.com.playandroidkotlin.ui.presenter

import fule.com.playandroidkotlin.base.BaseListModel
import fule.com.playandroidkotlin.base.BaseObserver
import fule.com.playandroidkotlin.base.BasePresenter
import fule.com.playandroidkotlin.ui.model.KnowledgeModel
import fule.com.playandroidkotlin.ui.view.KnowledgeView

/**
 * 作者： njb
 * 时间： 2018/8/9 0009-下午 6:04
 * 描述：
 * 来源：
 */
class KnowledgePresenter(baseView: KnowledgeView) : BasePresenter<KnowledgeView>(baseView) {

    fun tree() {
        addDisposable(apiServer.tree(), object : BaseObserver<BaseListModel<KnowledgeModel.DataBean>>(baseView) {
            override fun onSuccess(o: BaseListModel<KnowledgeModel.DataBean>) {
                baseView.onLoadTree(o.data!!)
            }

            override fun onError(msg: String?) {
                baseView.showError(msg!!)
            }
        })
    }
}
